<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="./js/easeljs-0.8.2.min.js"></script>
    <title>createJS学习</title>
</head>
<body>
<canvas id="canvas"></canvas>
<script>
    var count=0;
    var canvas = document.querySelector('#canvas');
    //创建舞台
    var stage = new createjs.Stage(canvas);
    //创建一个Shape对象，此处也可以创建文字Text,创建图片Bitmap
    var rect = new createjs.Shape();
    //用画笔设置颜色，调用方法画矩形，矩形参数：x,y,w,h
    rect.graphics.beginFill("#f00").drawRect(0, 0, 100, 100);
    
    var txt=new createjs.Text("你好","20px Arial","#e0e");
    txt.x=100;
    txt.y=100;
    
    //添加到舞台  
    stage.addChild(rect);
    stage.addChild(txt);
    createjs.Ticker.addEventListener("tick",tick);
    //刷新舞台
    

    function tick(e){
        count++;
        txt.text="你好"+count;
        stage.update();
    }
</script>   
</body>
</html>